package com.mission.chronometerandlifecycles

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {

    private lateinit var chronoMeter: MyChronometer
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        chronoMeter = findViewById(R.id.meter)
        lifecycle.addObserver(chronoMeter)

        chronoMeter.setOnClickListener {
            startActivity(Intent(this, SecondActivity::class.java))
        }
    }
}